package com.testmanager.testmananger.ArithMetic;

public class HuiWen {


    public static boolean isHuiWen(String str){
        int length = str.length();
        int left = 0;
        int right = length -1 ;
        while (left<right && str.charAt(left) == str.charAt(right)){
            left++;
            right--;
        }
        if (left>=right){
            return true;
        }
        return  false;
    }

    /**
     * 找出以一个位置为中心的最长回文
     * @param
     */

    public static int longestPalindrome(String s){

        int length = s.length();
        int longlength = 0;
        for (int i=0;i<s.length();i++){
            int a = expandAroundCenter(s,i,i);
            int b = expandAroundCenter(s,i,i+1);
            longlength = Math.max(longlength,Math.max(a,b));
        }
        return longlength;

    }

    private  static int expandAroundCenter(String s,int left,int right){

        while (left>=0 && right<s.length() && s.charAt(left) == s.charAt(right)){
            left--;
            right++;
        }

        return right - left -1;

    }

    public static void main(String[] args) {

        int a  = 10;


        System.out.println(isHuiWen("aabaa"));

        System.out.println(expandAroundCenter("abcefges",2,3));
        System.out.println(10-7/2);
    }




}
